473,426 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,426 software developers and data experts.

php rawurldecode from javascripts' escape()

Hi,

I'm sending some vars to php from javascript. These vars contain
special chars (like "&" ,",")and also turkish characters. Therefore
I'm using javascripts escape() function to be able to send them
properly. My problem is on the php side. I am using rawurldecode to
convert them back. However, Turkish characters like "I" (capital "I"
with a dot on top) for example still stay encoded as "%u0130".

My page is setup to handle turkish chars and if sent from a database,
display properly. I've googled for an answer and cant find anything.

I've also tried looking at base64 encoding from javascripts' end, to
again decode using base64Decode from php, but nothing seems to work
right.

Does anyone have any sugestions?

Thanks in advance,

Swayze

Oct 28 '05 #1
4 4054
swayze wrote:
I'm sending some vars to php from javascript. These vars contain
special chars (like "&" ,",")and also turkish characters. Therefore
I'm using javascripts escape() function to be able to send them
properly. My problem is on the php side. I am using rawurldecode to
convert them back. However, Turkish characters like "I" (capital "I"
with a dot on top) for example still stay encoded as "%u0130".


the doc for rawurldecode() says it decodes percent-encodings, but since
'%u0130' isn't a percent-encoding rawurldecode() doesn't decode it. to my
knowledge there isn't a (PHP) function which decodes your encodings.

encoded as UTF-8 and percent-encoded, as RFC3986 prescribes, 'Ä°' (U+0130)
is represented in URIs as <%C4%B0>. rawurldecode('%C4%B0') here gives me
the letter 'Ä°'.

--
Jock
Oct 29 '05 #2

swayze wrote:
Hi,

I'm sending some vars to php from javascript. These vars contain
special chars (like "&" ,",")and also turkish characters. Therefore
I'm using javascripts escape() function to be able to send them
properly. My problem is on the php side. I am using rawurldecode to
convert them back. However, Turkish characters like "I" (capital "I"
with a dot on top) for example still stay encoded as "%u0130".


Try using encodeURIComponent() instead of escape(). The function won't
help you though if you're not using UTF-8.

Instead of dealing with encoding issues manually, I would just create a
hidden form on the fly, fill it in, and submit it.

Oct 29 '05 #3
thanks for the replies. I'll try using encodeURIComponent() and hope
for the best. However, if this does not solve my problem, this form on
the fly, what did you have in mind? (Please bear with me. I'm originaly
a .net programmer :-S )

Let me explain my situation:

Right now I'm using iframes. a left and a right frame.
The left frame accesses the db, uses a web service, displays some
stuff, user interacts with the stuff, reaccesses db, web service ect...
at the end I'm changing, with javascript, the location of the right
frame with something like "parent.RIGHT.location =
'right.php?somevar='+might_have_turk_chars" in order to refresh the
contents. I could just send the right frame some numbers, but the with
all the intensive (and also redundant because the left frame has
already done all of it) webservice and db accesses, the delay can be
rather long. I'm just want to send the data to the right frame to be
appended to the existing data. I've considered updating the right frame
only using javascript, but found that building complex table structures
only using javascript and DOM with tds able to respond to javascript
events a little too challenging.

thaks again,

Swayze

Oct 30 '05 #4
swayze wrote:
thanks for the replies. I'll try using encodeURIComponent() and hope
for the best. However, if this does not solve my problem, this form on
the fly, what did you have in mind? (Please bear with me. I'm originaly
a .net programmer :-S )
Well, you would have a form with a hidden fields. Set the target of the
form to the frame you want, set the fields to the correct values, then
call submit() to send it. If the method is GET, then it's equivalent to
doing a location = <url>.
I've considered updating the right frame
only using javascript, but found that building complex table structures
only using javascript and DOM with tds able to respond to javascript
events a little too challenging.


It's not that hard really. The trick is to not try to construct the
page programmatically. Instead, build the HTML of the page as through
you'd on the server side, then do document.open(),
document.write(html), and document.close().

Oct 30 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Elf M. Sternberg | last post by:
It's all Netscape's fault. RFC 2396 (URI Specifications) specifies that a space shall be encoded using %20 and the plus symbol is always safe. Netscape (and possibly even earlier browsers like...
3
by: Kerberos | last post by:
When I deliver a page as text/html, the javascripts work, but if delivered as application/xhtml+xml, the javascripts don't work: function OpenBrWindow(theURL,winName,features, myWidth, myHeight,...
2
by: sdvoranchik | last post by:
We have an application that contains links that run javascripts to create pages in a separate frame. When these links open an external site, it causes the javascripts to no longer function. When...
2
by: LC's No-Spam Newsreading account | last post by:
I asked a couple of days ago about the following arrangement (simplified). I made some progress using netscape.security.PrivilegeManager.enablePrivilege but still have to ask some further help. ...
4
by: David Virgil Hobbs | last post by:
My web host inserts banner ads into my html pages. The javascript in these banner ads interferes with the onload triggered javascript functions in my pages. Whether I trigger my javascript...
6
by: daniel kaplan | last post by:
hi all, very new to this (javascript and the likes) so this might range in the dumb cataegory. when i am saving my external javascripts on the same server as all my HTML and Perl, etc scripts,...
2
by: and | last post by:
Hi I have been validating all day most things are cool but I cant get by this problem. One I have listed the script (JAVASCRIPT ) in all the right placesnot a prob but the validator insists...
2
by: Pavils Jurjans | last post by:
Hello, I am looking fow C# equivalent of JavaScripts escape() and unescape() functions. I need to use C# function at the server side and then be able to use the opposite at the client side. ...
4
by: januarynow | last post by:
Generally, my site contains javascripts (a couple of freebie counters plus some CPM (pay-per-impression) and CPC (pay-per-click) ads), from four different firms, but they are all suffering from the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.